import 'package:get/get.dart';
import 'package:school_assistant_m/store/login_store.dart';
import 'package:school_assistant_m/app/modules/home/controllers/home_controller.dart';

class MyHttp {
  static final homeController = Get.put(HomeController());

  // 添加token身份认证信息
  static addAuthorization() async {
    LoginStore store = LoginStore();
    String token = await store.getToken();
    return 'Token ' + token;
  }

  // 为GetConnect添加token身份认证信息
  static addGetAuthorization() async {
    LoginStore store = LoginStore();
    String token = await store.getToken();
    return 'Token ' + token;
  }

  // 添加token身份认证信息，并指明传输数据类型为json
  static addAuthorizationJson() async {
    LoginStore store = LoginStore();
    String token = await store.getToken();
    return {
      'Authorization': 'Token ' + token,
      'Content-Type': 'application/json'
    };
  }
}
